var pool = require('../dao/dbConnect.js');
var logger = require('../base/log.js')('err');

var cookie = {
	insert: function(cookie){

		pool.getConnection(function(err,connection){
			if(err){
				logger.error(err);
			}
			var insert = 'INSERT INTO cookie SET ?';
			connection.query(insert,cookie,funtction(err,results){
				if (err) {
					logger.error(err);
					results = 'error';
				}
				connection.release();
			});
		});
	},

	update: function(cookie){
		pool.getConnection(function(err,connection){
			if (err) {
				logger.error(err);
			};
			var update = 'UPDATE cookie SET cookie = :cookie WHERE account = :account';
			connection.query(update,cookie,function(err,results){
				if(err){
					logger.error(err);
					results = 'error';
				}
				connection.release();
			});
		});
	}
};

module.exports = cookie;